package cn.elwy.rcp.ui.explorer.core.handler;

import cn.elwy.rcp.core.model.ui.progress.ProgressMonitor;
import cn.elwy.rcp.ui.explorer.core.util.SVNClient;
import cn.elwy.rcp.ui.explorer.core.vo.ProjectConfig;

public class PackerHandler extends ProjectServiceHandler {

	private SVNClient svnClient;

	@Override
	protected Object handler(ProjectConfig projectConfig, ProgressMonitor monitor) {
		try {
			SvnUpdateHandler suh = new SvnUpdateHandler();
			suh.setSvnClient(svnClient);

			SyncVersionHandler svh = new SyncVersionHandler();

			OutputFileHandler dbs = new OutputFileHandler();

			MavenHandler mh = new MavenHandler();
			SvnCommitHandler cmh = new SvnCommitHandler();
			cmh.setSvnClient(svnClient);
			SvnTagsHandler sth = new SvnTagsHandler();
			sth.setSvnClient(svnClient);

			DeployHandler dh = new DeployHandler();
			ReleaseHandler rh = new ReleaseHandler();

			// 更新源码
			register(suh);
			// 同步版本号
			register(svh);
			// maven打包
			register(mh);
			// 提交代码
			register(cmh);
			// 复制输出文件
			register(dbs);
			// 版本标记
			register(sth);
			// 发布
			register(rh);
			// 部署
			register(dh);

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return null;
	}

	public SVNClient getSvnClient() {
		return svnClient;
	}

	public void setSvnClient(SVNClient svnClient) {
		this.svnClient = svnClient;
	}

}
